﻿@model IList<ProductSpecificationModel>

@using SmartStore.Web.Models.Catalog

@{ 
	if (Model.Count == 0)
	{
		return;
	}

	var grouped = Model.GroupBy(x => x.SpecificationAttributeName);
}

<div class="pd-specs table-responsive">
	<table class="table pd-specs-table">
		<tbody>
			@foreach (var group in grouped)
			{
				<tr>
					<td class="pd-spec-name" @Html.LanguageAttributes(group.Key)>@group.Key</td>
					<td class="pd-spec-value">
						@if (group.Count() == 1)
						{
							var option = group.First().SpecificationAttributeOption;
							<span @Html.LanguageAttributes(option)>@option</span>
						}
						else if (group.Count() > 1)
						{
							<ul class="mb-0 pl-3">
								@foreach (var item in group)
								{
									<li class="pb-1"><span @Html.LanguageAttributes(item.SpecificationAttributeOption)>@item.SpecificationAttributeOption</span></li>
								}
							</ul>
						}
					</td>
				</tr>
			}
		</tbody>
	</table>
</div>